package com.example.demo.controller;

import com.example.demo.common.Result;
import com.example.demo.entity.UserRole;
import com.example.demo.service.RoleUserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/roleUser")
public class RoleUserMapController {
    @Resource
    RoleUserService roleUserService;

    /**
     * 为用户分配角色
     * @param
     * @param
     * @return
     */
    @PostMapping("/addRoleToUser")
    public Result<?> addRoleToUser(@RequestBody List<UserRole> userRoleList){
        return roleUserService.addRoleToUser(userRoleList);
    }

    @PostMapping("/cancelUserRole")
    public Result<?> cancleUserRole(@RequestBody List<UserRole> userRoleList){
        return roleUserService.deleteRoleToUser(userRoleList);
    }
}
